<?php

namespace App\model;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
	/*
	*@content 角色
	*@author  *****
    */

	public $table = 'role';


	/**
	 *  @content 角色权限列表(查看角色所具有的权限)
	 *  @author  *****
	 */

	 public function rolePower($role)
	{

	    foreach($role as $k=>$v)
		{
		   $power=$this->join('role_power','role.r_id','=','role_power.r_id')
		               ->join('power','power.p_id','=','role_power.p_id')
			           ->where('role_power.r_id',$v['r_id'])
		               ->get()
			           ->toArray();
           
           $role[$k]['power']=$power;
		   

		}

        return $role;

	 }
     




}